const requireDirectory = require('require-directory')

const apiRegister = (app) => {
  const modules = requireDirectory(module, `./routes`)
  Object.keys(modules).forEach((name) => {
    app.use(modules[name].routes())
  })
}

module.exports = apiRegister
